#ifndef __SPINLOCK_H__
#define __SPINLOCK_H__

typedef struct spinlock_t spinlock_t;

typedef struct cpu_t cpu_t;
typedef struct proc_t proc_t;

struct spinlock_t {
    unsigned char locked;
    char* name;

    // only one cpu
    cpu_t* cpu;
    // struct cpu *cpu;
};

int spinlock_isHold(spinlock_t* lk);             //判断锁是否已持有
void spinlock_init(spinlock_t* lk, char* name);  //初始化自旋锁
void spinlock_acquire(spinlock_t* lk);           //获取自旋锁
void spinlock_release(spinlock_t* lk);           //释放自旋锁

#endif